package com.lx.bbs.service.impl;

import com.lx.bbs.entity.Reply;
import com.lx.bbs.dao.ReplyMapper;
import com.lx.bbs.entity.User;
import com.lx.bbs.service.IReplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * BBS论坛-回帖表-2 服务实现类
 * </p>
 *
 * @author lx
 * @since 2024-11-23
 */
@Service
public class ReplyServiceImpl extends ServiceImpl<ReplyMapper, Reply> implements IReplyService {

    @Override
    public void reply(String title, String content, int id, int uid) {
        Reply reply = new Reply();
        reply.setTitle(title);
        reply.setContent(content);
        reply.setTopicid(id);
        reply.setUid(uid);
        reply.setPublishtime(LocalDateTime.now());
        reply.setModifytime(LocalDateTime.now());
        baseMapper.insert(reply);
    }

    @Override
    public void reReply(String title, String content, int rid, int uid) {
        Reply reply = new Reply();
        reply.setTitle(title);
        reply.setContent(content);
        reply.setReplyid(rid);
        reply.setUid(uid);
        reply.setPublishtime(LocalDateTime.now());
        reply.setModifytime(LocalDateTime.now());
        baseMapper.insert(reply);
    }
}
